﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Win32;

namespace HomeFramework.Client.Utilities
{
    public partial class HFUtils
    {
        public static List<string> MonitoredPaths { get; set; }

        static HFUtils()
        {
            MonitoredPaths = new List<string>();
        }

        public static void SetupFirstStart()
        {
            var reg = Registry.CurrentUser
                .CreateSubKey("Software")
                .CreateSubKey("DotNetLombardia")
                .CreateSubKey("HomeFramework");
            var tmp = reg.GetValue("MonitoredPaths");
            if (tmp != null) MonitoredPaths.AddRange(tmp.ToString().Split(';'));
        }

        public static void SaveStatus()
        {
            var reg = Registry.CurrentUser
                .CreateSubKey("Software")
                .CreateSubKey("DotNetLombardia")
                .CreateSubKey("HomeFramework");
            reg.SetValue("MonitoredPaths", MonitoredPaths.Aggregate((res, item) => { return res += "," + item; }));
        }
    }
}
